add qrcode version

FFIB 5 years ago
parent
commit
4bc66d3c9c
3 changed files with 15 additions and 0 deletions
  1. 1 0
      integral/models.py
  2. 3 0
      logs/models.py
  3. 11 0
      page/sale_views.py

+ 1 - 0
integral/models.py

@@ -115,6 +115,7 @@ class SaleclerkSubmitLogInfo(BaseModelMixin):
115 115
     is_wxwork = models.BooleanField(_(u'is_wxwork'), default=False, help_text=_(u'是否为企业微信端'), db_index=True)
116 116
 
117 117
     is_staff_delete = models.BooleanField(_(u'is_staff_delete'), default=False, help_text=_(u'是否管理员删除'), db_index=True)
118
+    code_version = models.IntegerField(_(u'code_version'), default=1, help_text=_(u'是否新码'), db_index=True)
118 119
 
119 120
     class Meta:
120 121
         verbose_name = _(u'销售员扫码出库记录')

+ 3 - 0
logs/models.py

@@ -18,6 +18,9 @@ class MchInfoEncryptLogInfo(BaseModelMixin):
18 18
 
19 19
     sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True)
20 20
 
21
+    #二维码版本
22
+    version=models.IntegerField(_(u'version'), default=2, help_text=u'二维码版本', db_index=True)
23
+
21 24
     # 一物一码
22 25
     application_id = models.IntegerField(_(u'application_id'), default=0, help_text=u'申请单号', db_index=True)
23 26
     code = models.CharField(_(u'code'), max_length=16, blank=True, null=True, help_text=u'九位的字符串原始码', db_index=True)

+ 11 - 0
page/sale_views.py

@@ -17,6 +17,8 @@ from statistic.models import (DistributorSaleStatisticInfo, ModelSaleStatisticIn
17 17
                               SaleclerkSaleStatisticInfo, SaleStatisticInfo)
18 18
 from utils.error.errno_utils import (ProductBrandStatusCode, ProductDistributorStatusCode, ProductMachineStatusCode,
19 19
                                      ProductModelStatusCode, SaleclerkStatusCode)
20
+import os,sys,string
21
+
20 22
 
21 23
 
22 24
 @logit
@@ -99,6 +101,14 @@ def clerk_sale_submit_api(request):
99 101
     # 是否被消费者扫过
100 102
     has_scan = ConsumeInfoSubmitLogInfo.objects.filter(model_id=model.model_id, serialNo=serialNo).exists()
101 103
 
104
+    #是否是新二维码,即统览码2
105
+    code_version = 1
106
+    code = filter(lambda ch: ch in '0123456789', serialNo)
107
+    encrypt_logs = MchInfoEncryptLogInfo.objects.filter(model_id=model.pk, sn=code)
108
+
109
+    if encrypt_logs:
110
+        code_version = encrypt_logs[0].version        
111
+
102 112
     # 店员提交记录
103 113
     ssli = SaleclerkSubmitLogInfo.objects.create(
104 114
         brand_pk=brand.pk,
@@ -123,6 +133,7 @@ def clerk_sale_submit_api(request):
123 133
         has_scan=has_scan,
124 134
         trackingNo=trackingNo,
125 135
         is_wxwork=is_wxwork,
136
+        code_version=code_version,
126 137
     )
127 138
 
128 139
     if test_sn: